package com.example.core.arch.exception;

import com.example.core.arch.baseData.CodeConstants;
import lombok.Data;

@Data
public class VerifyException extends RuntimeException {

    private String code;

    private String errorMessage;

    public VerifyException(String code, String errorMessage) {
        this.code = code;
        this.errorMessage = errorMessage;
    }

    public static void VerifyParam(Boolean condition, String code, String errorMessage) {
        if (condition) {
            throw new VerifyException(code, errorMessage);
        }
    }

    public static void VerifyParam(Boolean condition, String errorMessage) {
        VerifyParam(condition, CodeConstants.FAIL_CODE, errorMessage);
    }
}
